From: Timo Röhling Date: Thu, 25 May 2023 12:21:55 +0000 (+0200) Subject: Consolidate patches X-Git-Tag: archive/raspbian/1.9.25+dfsg3-1+rpi1^2~38 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https://%22Program/%22http:/www.example.com/cgi/%22https:/%22Program?a=commitdiff_plain;h=5a65d21795aab672b27d8672474637472ee75849;p=filament.git Consolidate patches --- diff --git a/debian/patches/0001-Build-against-system-libraries.patch b/debian/patches/0001-Build-against-system-libraries.patch index 87db874..5239ab6 100644 --- a/debian/patches/0001-Build-against-system-libraries.patch +++ b/debian/patches/0001-Build-against-system-libraries.patch @@ -1,16 +1,17 @@ From: =?utf-8?q?Timo_R=C3=B6hling?= -Date: Sat, 23 Oct 2021 19:17:07 +0200 +Date: Wed, 24 May 2023 23:55:51 +0200 Subject: Build against system libraries --- - CMakeLists.txt | 38 +++++++++++++++++++++----------------- - 1 file changed, 21 insertions(+), 17 deletions(-) + CMakeLists.txt | 44 +++++++++++++++++++++++++------------------- + libs/filamat/CMakeLists.txt | 2 +- + 2 files changed, 26 insertions(+), 20 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt -index aa51851..b82a941 100644 +index aa51851..960f49f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -573,12 +573,25 @@ function(get_resgen_vars ARCHIVE_DIR ARCHIVE_NAME) +@@ -573,12 +573,30 @@ function(get_resgen_vars ARCHIVE_DIR ARCHIVE_NAME) endif() endfunction() @@ -18,15 +19,20 @@ index aa51851..b82a941 100644 +# External dependencies +# ================================================================================================== +find_package(GTest REQUIRED) ++find_package(astcenc REQUIRED) +find_package(tsl-robin-map REQUIRED) +find_package(meshoptimizer REQUIRED) +find_package(draco REQUIRED) ++set(THREADS_PREFER_PTHREAD_FLAG ON) ++find_package(Threads REQUIRED) +if(IS_HOST_PLATFORM) + find_package(PNG REQUIRED) + find_package(SDL2 REQUIRED) + find_package(ZLIB REQUIRED) + find_package(tinyexr REQUIRED) +endif() ++include(debian/cmake/imgui.cmake) ++include(debian/cmake/stb.cmake) + # ================================================================================================== # Sub-projects @@ -37,13 +43,12 @@ index aa51851..b82a941 100644 add_subdirectory(${LIBRARIES}/camutils) add_subdirectory(${LIBRARIES}/filabridge) add_subdirectory(${LIBRARIES}/filaflat) -@@ -597,22 +610,17 @@ add_subdirectory(${FILAMENT}/filament) +@@ -597,23 +615,16 @@ add_subdirectory(${FILAMENT}/filament) add_subdirectory(${FILAMENT}/shaders) add_subdirectory(${EXTERNAL}/civetweb/tnt) add_subdirectory(${EXTERNAL}/hat-trie/tnt) -add_subdirectory(${EXTERNAL}/imgui/tnt) -add_subdirectory(${EXTERNAL}/robin-map/tnt) -+include(debian/cmake/imgui.cmake) add_subdirectory(${EXTERNAL}/smol-v/tnt) -add_subdirectory(${EXTERNAL}/benchmark/tnt) -add_subdirectory(${EXTERNAL}/meshoptimizer) @@ -53,7 +58,6 @@ index aa51851..b82a941 100644 -add_subdirectory(${EXTERNAL}/jsmn/tnt) -add_subdirectory(${EXTERNAL}/stb/tnt) +include(debian/cmake/jsmn.cmake) -+include(debian/cmake/stb.cmake) add_subdirectory(${EXTERNAL}/getopt) if (FILAMENT_BUILD_FILAMAT OR IS_HOST_PLATFORM) @@ -61,14 +65,18 @@ index aa51851..b82a941 100644 - # spirv-tools_SOURCE_DIR variable. - add_subdirectory(${EXTERNAL}/spirv-tools) - add_subdirectory(${EXTERNAL}/glslang/tnt) +- add_subdirectory(${EXTERNAL}/spirv-cross/tnt) + include(debian/cmake/spirv-tools.cmake) + include(debian/cmake/glslang.cmake) - add_subdirectory(${EXTERNAL}/spirv-cross/tnt) ++ include(debian/cmake/spirv-cross.cmake) add_subdirectory(${LIBRARIES}/filamat) -@@ -651,11 +659,7 @@ if (IS_HOST_PLATFORM) + # the material debugger requires filamat +@@ -649,13 +660,8 @@ if (IS_HOST_PLATFORM) - add_subdirectory(${EXTERNAL}/astcenc/tnt) + add_subdirectory(${FILAMENT}/samples) + +- add_subdirectory(${EXTERNAL}/astcenc/tnt) add_subdirectory(${EXTERNAL}/etc2comp) - add_subdirectory(${EXTERNAL}/libassimp/tnt) - add_subdirectory(${EXTERNAL}/libpng/tnt) @@ -79,3 +87,16 @@ index aa51851..b82a941 100644 add_subdirectory(${TOOLS}/cmgen) add_subdirectory(${TOOLS}/cso-lut) +diff --git a/libs/filamat/CMakeLists.txt b/libs/filamat/CMakeLists.txt +index 9645004..2271e83 100644 +--- a/libs/filamat/CMakeLists.txt ++++ b/libs/filamat/CMakeLists.txt +@@ -104,7 +104,7 @@ if (APPLE OR MSVC) + target_link_libraries(${TARGET} glslang SPIRV SPVRemapper SPIRV-Tools-opt spirv-cross-glsl) + else() + target_link_libraries(${TARGET} +- -Wl,--start-group glslang SPIRV SPVRemapper SPIRV-Tools-opt spirv-cross-glsl -Wl,--end-group) ++ -Wl,--start-group glslang SPIRV SPVRemapper SPIRV-Tools-opt spirv-cross -Wl,--end-group) + endif() + + # ================================================================================================== diff --git a/debian/patches/0002-Disable-Java.patch b/debian/patches/0002-Disable-Java.patch index dd00219..ef7de5c 100644 --- a/debian/patches/0002-Disable-Java.patch +++ b/debian/patches/0002-Disable-Java.patch @@ -7,10 +7,10 @@ Subject: Disable Java 1 file changed, 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt -index b82a941..b6cd7ab 100644 +index 960f49f..d379ff1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -651,10 +651,6 @@ if (IS_HOST_PLATFORM) +@@ -654,10 +654,6 @@ if (IS_HOST_PLATFORM) add_subdirectory(${LIBRARIES}/filamentapp) add_subdirectory(${LIBRARIES}/imageio) @@ -20,4 +20,4 @@ index b82a941..b6cd7ab 100644 - add_subdirectory(${FILAMENT}/samples) - add_subdirectory(${EXTERNAL}/astcenc/tnt) + add_subdirectory(${EXTERNAL}/etc2comp) diff --git a/debian/patches/0004-Fix-combine_static_libs-macro.patch b/debian/patches/0004-Fix-combine_static_libs-macro.patch index b6bc7c2..ea6fee4 100644 --- a/debian/patches/0004-Fix-combine_static_libs-macro.patch +++ b/debian/patches/0004-Fix-combine_static_libs-macro.patch @@ -7,7 +7,7 @@ Subject: Fix combine_static_libs macro 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt -index b6cd7ab..6786b22 100644 +index d379ff1..f637432 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -495,7 +495,12 @@ function(combine_static_libs TARGET OUTPUT DEPS) diff --git a/debian/patches/0005-Fix-list_licenses-macro.patch b/debian/patches/0005-Fix-list_licenses-macro.patch index 0c104cf..3d2d087 100644 --- a/debian/patches/0005-Fix-list_licenses-macro.patch +++ b/debian/patches/0005-Fix-list_licenses-macro.patch @@ -7,7 +7,7 @@ Subject: Fix list_licenses macro 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt -index 6786b22..8d674dc 100644 +index f637432..46ee62f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -475,11 +475,13 @@ function(list_licenses OUTPUT MODULES) diff --git a/debian/patches/0006-Adjust-linker-flags.patch b/debian/patches/0006-Adjust-linker-flags.patch index 981f96e..ef09c18 100644 --- a/debian/patches/0006-Adjust-linker-flags.patch +++ b/debian/patches/0006-Adjust-linker-flags.patch @@ -7,7 +7,7 @@ Subject: Adjust linker flags 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt -index 8d674dc..ce4192c 100644 +index 46ee62f..f7eb993 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -331,12 +331,6 @@ endif() diff --git a/debian/patches/0009-Fix-library-export-for-Debian.patch b/debian/patches/0009-Fix-library-export-for-Debian.patch index 15c1757..4879353 100644 --- a/debian/patches/0009-Fix-library-export-for-Debian.patch +++ b/debian/patches/0009-Fix-library-export-for-Debian.patch @@ -1,9 +1,9 @@ From: =?utf-8?q?Timo_R=C3=B6hling?= -Date: Tue, 25 Jan 2022 22:04:07 +0100 +Date: Wed, 24 May 2023 22:47:17 +0200 Subject: Fix library export for Debian --- - CMakeLists.txt | 24 ++++++++++-- + CMakeLists.txt | 16 ++++++++ filament/CMakeLists.txt | 54 +++++++++++++++++++-------- filament/backend/CMakeLists.txt | 47 ++++++++++++++++-------- filament/benchmark/CMakeLists.txt | 3 +- @@ -37,55 +37,13 @@ Subject: Fix library export for Debian tools/mipgen/CMakeLists.txt | 2 +- tools/normal-blending/CMakeLists.txt | 2 +- tools/roughness-prefilter/CMakeLists.txt | 2 +- - 34 files changed, 508 insertions(+), 249 deletions(-) + 34 files changed, 503 insertions(+), 246 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt -index ce4192c..a95c557 100644 +index f7eb993..fa3099f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -577,15 +577,20 @@ endfunction() - # External dependencies - # ================================================================================================== - find_package(GTest REQUIRED) -+find_package(astcenc REQUIRED) - find_package(tsl-robin-map REQUIRED) - find_package(meshoptimizer REQUIRED) - find_package(draco REQUIRED) -+set(THREADS_PREFER_PTHREAD_FLAG ON) -+find_package(Threads REQUIRED) - if(IS_HOST_PLATFORM) - find_package(PNG REQUIRED) - find_package(SDL2 REQUIRED) - find_package(ZLIB REQUIRED) - find_package(tinyexr REQUIRED) - endif() -+include(debian/cmake/imgui.cmake) -+include(debian/cmake/stb.cmake) - - # ================================================================================================== - # Sub-projects -@@ -610,12 +615,10 @@ add_subdirectory(${FILAMENT}/filament) - add_subdirectory(${FILAMENT}/shaders) - add_subdirectory(${EXTERNAL}/civetweb/tnt) - add_subdirectory(${EXTERNAL}/hat-trie/tnt) --include(debian/cmake/imgui.cmake) - add_subdirectory(${EXTERNAL}/smol-v/tnt) - include(debian/cmake/benchmark.cmake) - add_subdirectory(${EXTERNAL}/cgltf/tnt) - include(debian/cmake/jsmn.cmake) --include(debian/cmake/stb.cmake) - add_subdirectory(${EXTERNAL}/getopt) - - if (FILAMENT_BUILD_FILAMAT OR IS_HOST_PLATFORM) -@@ -653,7 +656,6 @@ if (IS_HOST_PLATFORM) - - add_subdirectory(${FILAMENT}/samples) - -- add_subdirectory(${EXTERNAL}/astcenc/tnt) - add_subdirectory(${EXTERNAL}/etc2comp) - include(debian/cmake/libassimp.cmake) - -@@ -674,3 +676,19 @@ endif() +@@ -676,3 +676,19 @@ endif() if (NOT CMAKE_CROSSCOMPILING) export(TARGETS matc cmgen filamesh mipgen resgen glslminifier FILE ${IMPORT_EXECUTABLES}) endif() @@ -544,7 +502,7 @@ index fe5373e..683d022 100644 # ================================================================================================== # Compiler flags diff --git a/libs/filamat/CMakeLists.txt b/libs/filamat/CMakeLists.txt -index 9645004..a130f0c 100644 +index 2271e83..9b38857 100644 --- a/libs/filamat/CMakeLists.txt +++ b/libs/filamat/CMakeLists.txt @@ -84,18 +84,36 @@ include_directories(${PUBLIC_HDR_DIR}) @@ -600,7 +558,7 @@ index 9645004..a130f0c 100644 else() - target_link_libraries(${TARGET} + target_link_libraries(${TARGET} PRIVATE - -Wl,--start-group glslang SPIRV SPVRemapper SPIRV-Tools-opt spirv-cross-glsl -Wl,--end-group) + -Wl,--start-group glslang SPIRV SPVRemapper SPIRV-Tools-opt spirv-cross -Wl,--end-group) endif() @@ -151,14 +169,14 @@ set(FILAMAT_DEPS diff --git a/debian/patches/0011-Replace-BlueGL-with-epoxy.patch b/debian/patches/0011-Replace-BlueGL-with-epoxy.patch index 6e7c9ee..c1ee375 100644 --- a/debian/patches/0011-Replace-BlueGL-with-epoxy.patch +++ b/debian/patches/0011-Replace-BlueGL-with-epoxy.patch @@ -15,7 +15,7 @@ Subject: Replace BlueGL with epoxy 9 files changed, 36 insertions(+), 151 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt -index a95c557..5c117c3 100644 +index fa3099f..632ece6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -650,7 +650,6 @@ if (WEBGL) diff --git a/debian/patches/0012-Define-M_PIf-only-if-it-is-not-already-defined-in-ma.patch b/debian/patches/0012-Define-M_PIf-only-if-it-is-not-already-defined-in-ma.patch new file mode 100644 index 0000000..554a285 --- /dev/null +++ b/debian/patches/0012-Define-M_PIf-only-if-it-is-not-already-defined-in-ma.patch @@ -0,0 +1,22 @@ +From: =?utf-8?q?Timo_R=C3=B6hling?= +Date: Mon, 7 Feb 2022 10:12:08 +0100 +Subject: Define M_PIf only if it is not already defined in math.h + +--- + libs/image/src/ImageSampler.cpp | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/libs/image/src/ImageSampler.cpp b/libs/image/src/ImageSampler.cpp +index 00385e9..53c68e8 100644 +--- a/libs/image/src/ImageSampler.cpp ++++ b/libs/image/src/ImageSampler.cpp +@@ -38,7 +38,9 @@ struct FilterFunction { + bool rejectExternalSamples = true; + }; + ++#ifndef M_PIf + constexpr float M_PIf = float(filament::math::F_PI); ++#endif + + const FilterFunction Box { + .fn = [](float t) { return t <= 0.5f ? 1.0f : 0.0f; }, diff --git a/debian/patches/0012-Use-system-spirv-cross.patch b/debian/patches/0012-Use-system-spirv-cross.patch deleted file mode 100644 index d449c51..0000000 --- a/debian/patches/0012-Use-system-spirv-cross.patch +++ /dev/null @@ -1,35 +0,0 @@ -From: =?utf-8?q?Timo_R=C3=B6hling?= -Date: Thu, 27 Jan 2022 19:50:26 +0100 -Subject: Use system spirv-cross - ---- - CMakeLists.txt | 2 +- - libs/filamat/CMakeLists.txt | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 5c117c3..632ece6 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -624,7 +624,7 @@ add_subdirectory(${EXTERNAL}/getopt) - if (FILAMENT_BUILD_FILAMAT OR IS_HOST_PLATFORM) - include(debian/cmake/spirv-tools.cmake) - include(debian/cmake/glslang.cmake) -- add_subdirectory(${EXTERNAL}/spirv-cross/tnt) -+ include(debian/cmake/spirv-cross.cmake) - add_subdirectory(${LIBRARIES}/filamat) - - # the material debugger requires filamat -diff --git a/libs/filamat/CMakeLists.txt b/libs/filamat/CMakeLists.txt -index a130f0c..9b38857 100644 ---- a/libs/filamat/CMakeLists.txt -+++ b/libs/filamat/CMakeLists.txt -@@ -122,7 +122,7 @@ if (APPLE OR MSVC) - target_link_libraries(${TARGET} glslang SPIRV SPVRemapper SPIRV-Tools-opt spirv-cross-glsl) - else() - target_link_libraries(${TARGET} PRIVATE -- -Wl,--start-group glslang SPIRV SPVRemapper SPIRV-Tools-opt spirv-cross-glsl -Wl,--end-group) -+ -Wl,--start-group glslang SPIRV SPVRemapper SPIRV-Tools-opt spirv-cross -Wl,--end-group) - endif() - - # ================================================================================================== diff --git a/debian/patches/0013-Avoid-mips-as-identifier-because-it-fails-on-mips-ar.patch b/debian/patches/0013-Avoid-mips-as-identifier-because-it-fails-on-mips-ar.patch new file mode 100644 index 0000000..2dcc85e --- /dev/null +++ b/debian/patches/0013-Avoid-mips-as-identifier-because-it-fails-on-mips-ar.patch @@ -0,0 +1,62 @@ +From: =?utf-8?q?Timo_R=C3=B6hling?= +Date: Mon, 7 Feb 2022 10:30:35 +0100 +Subject: Avoid mips as identifier because it fails on mips* arch + +--- + libs/image/src/ImageSampler.cpp | 6 +++--- + libs/image/tests/test_image.cpp | 12 ++++++------ + 2 files changed, 9 insertions(+), 9 deletions(-) + +diff --git a/libs/image/src/ImageSampler.cpp b/libs/image/src/ImageSampler.cpp +index 53c68e8..80ae4b7 100644 +--- a/libs/image/src/ImageSampler.cpp ++++ b/libs/image/src/ImageSampler.cpp +@@ -339,11 +339,11 @@ void computeSingleSample(const LinearImage& source, float x, float y, SingleSamp + + // Unlike traditional mipmap generation, our implementation generates all levels from the original + // image, under the premise that this produces a higher quality result. +-void generateMipmaps(const LinearImage& source, Filter filter, LinearImage* result, uint32_t mips) { +- mips = std::min(mips, getMipmapCount(source)); ++void generateMipmaps(const LinearImage& source, Filter filter, LinearImage* result, uint32_t mipCount) { ++ mipCount = std::min(mipCount, getMipmapCount(source)); + uint32_t width = source.getWidth(); + uint32_t height = source.getHeight(); +- for (uint32_t n = 0; n < mips; ++n) { ++ for (uint32_t n = 0; n < mipCount; ++n) { + width = std::max(width >> 1u, 1u); + height = std::max(height >> 1u, 1u); + result[n] = resampleImage(source, width, height, filter); +diff --git a/libs/image/tests/test_image.cpp b/libs/image/tests/test_image.cpp +index 963515a..7ceb323 100644 +--- a/libs/image/tests/test_image.cpp ++++ b/libs/image/tests/test_image.cpp +@@ -342,11 +342,11 @@ TEST_F(ImageTest, Mipmaps) { // NOLINT + "44444 41014 40704 41014 44444 44444 41014 40704 41014 44444"); + uint32_t count = getMipmapCount(src); + ASSERT_EQ(count, 3); +- vector mips(count); +- generateMipmaps(src, filter, mips.data(), count); ++ vector mipmaps(count); ++ generateMipmaps(src, filter, mipmaps.data(), count); + updateOrCompare(src, "mip0_5x10.png"); + for (uint32_t index = 0; index < count; ++index) { +- updateOrCompare(mips[index], "mip" + std::to_string(index + 1) + "_5x10.png"); ++ updateOrCompare(mipmaps[index], "mip" + std::to_string(index + 1) + "_5x10.png"); + } + + // Test color space with a classic RED => GREEN color gradient. +@@ -354,11 +354,11 @@ TEST_F(ImageTest, Mipmaps) { // NOLINT + src = resampleImage(src, 200, 100, Filter::NEAREST); + count = getMipmapCount(src); + ASSERT_EQ(count, 7); +- mips.resize(count); +- generateMipmaps(src, filter, mips.data(), count); ++ mipmaps.resize(count); ++ generateMipmaps(src, filter, mipmaps.data(), count); + updateOrCompare(src, "mip0_200x100.png"); + for (uint32_t index = 0; index < count; ++index) { +- updateOrCompare(mips[index], "mip" + std::to_string(index + 1) + "_200x100.png"); ++ updateOrCompare(mipmaps[index], "mip" + std::to_string(index + 1) + "_200x100.png"); + } + } + diff --git a/debian/patches/0013-Define-M_PIf-only-if-it-is-not-already-defined-in-ma.patch b/debian/patches/0013-Define-M_PIf-only-if-it-is-not-already-defined-in-ma.patch deleted file mode 100644 index 554a285..0000000 --- a/debian/patches/0013-Define-M_PIf-only-if-it-is-not-already-defined-in-ma.patch +++ /dev/null @@ -1,22 +0,0 @@ -From: =?utf-8?q?Timo_R=C3=B6hling?= -Date: Mon, 7 Feb 2022 10:12:08 +0100 -Subject: Define M_PIf only if it is not already defined in math.h - ---- - libs/image/src/ImageSampler.cpp | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/libs/image/src/ImageSampler.cpp b/libs/image/src/ImageSampler.cpp -index 00385e9..53c68e8 100644 ---- a/libs/image/src/ImageSampler.cpp -+++ b/libs/image/src/ImageSampler.cpp -@@ -38,7 +38,9 @@ struct FilterFunction { - bool rejectExternalSamples = true; - }; - -+#ifndef M_PIf - constexpr float M_PIf = float(filament::math::F_PI); -+#endif - - const FilterFunction Box { - .fn = [](float t) { return t <= 0.5f ? 1.0f : 0.0f; }, diff --git a/debian/patches/0014-Avoid-mips-as-identifier-because-it-fails-on-mips-ar.patch b/debian/patches/0014-Avoid-mips-as-identifier-because-it-fails-on-mips-ar.patch deleted file mode 100644 index 2dcc85e..0000000 --- a/debian/patches/0014-Avoid-mips-as-identifier-because-it-fails-on-mips-ar.patch +++ /dev/null @@ -1,62 +0,0 @@ -From: =?utf-8?q?Timo_R=C3=B6hling?= -Date: Mon, 7 Feb 2022 10:30:35 +0100 -Subject: Avoid mips as identifier because it fails on mips* arch - ---- - libs/image/src/ImageSampler.cpp | 6 +++--- - libs/image/tests/test_image.cpp | 12 ++++++------ - 2 files changed, 9 insertions(+), 9 deletions(-) - -diff --git a/libs/image/src/ImageSampler.cpp b/libs/image/src/ImageSampler.cpp -index 53c68e8..80ae4b7 100644 ---- a/libs/image/src/ImageSampler.cpp -+++ b/libs/image/src/ImageSampler.cpp -@@ -339,11 +339,11 @@ void computeSingleSample(const LinearImage& source, float x, float y, SingleSamp - - // Unlike traditional mipmap generation, our implementation generates all levels from the original - // image, under the premise that this produces a higher quality result. --void generateMipmaps(const LinearImage& source, Filter filter, LinearImage* result, uint32_t mips) { -- mips = std::min(mips, getMipmapCount(source)); -+void generateMipmaps(const LinearImage& source, Filter filter, LinearImage* result, uint32_t mipCount) { -+ mipCount = std::min(mipCount, getMipmapCount(source)); - uint32_t width = source.getWidth(); - uint32_t height = source.getHeight(); -- for (uint32_t n = 0; n < mips; ++n) { -+ for (uint32_t n = 0; n < mipCount; ++n) { - width = std::max(width >> 1u, 1u); - height = std::max(height >> 1u, 1u); - result[n] = resampleImage(source, width, height, filter); -diff --git a/libs/image/tests/test_image.cpp b/libs/image/tests/test_image.cpp -index 963515a..7ceb323 100644 ---- a/libs/image/tests/test_image.cpp -+++ b/libs/image/tests/test_image.cpp -@@ -342,11 +342,11 @@ TEST_F(ImageTest, Mipmaps) { // NOLINT - "44444 41014 40704 41014 44444 44444 41014 40704 41014 44444"); - uint32_t count = getMipmapCount(src); - ASSERT_EQ(count, 3); -- vector mips(count); -- generateMipmaps(src, filter, mips.data(), count); -+ vector mipmaps(count); -+ generateMipmaps(src, filter, mipmaps.data(), count); - updateOrCompare(src, "mip0_5x10.png"); - for (uint32_t index = 0; index < count; ++index) { -- updateOrCompare(mips[index], "mip" + std::to_string(index + 1) + "_5x10.png"); -+ updateOrCompare(mipmaps[index], "mip" + std::to_string(index + 1) + "_5x10.png"); - } - - // Test color space with a classic RED => GREEN color gradient. -@@ -354,11 +354,11 @@ TEST_F(ImageTest, Mipmaps) { // NOLINT - src = resampleImage(src, 200, 100, Filter::NEAREST); - count = getMipmapCount(src); - ASSERT_EQ(count, 7); -- mips.resize(count); -- generateMipmaps(src, filter, mips.data(), count); -+ mipmaps.resize(count); -+ generateMipmaps(src, filter, mipmaps.data(), count); - updateOrCompare(src, "mip0_200x100.png"); - for (uint32_t index = 0; index < count; ++index) { -- updateOrCompare(mips[index], "mip" + std::to_string(index + 1) + "_200x100.png"); -+ updateOrCompare(mipmaps[index], "mip" + std::to_string(index + 1) + "_200x100.png"); - } - } - diff --git a/debian/patches/0014-Ensure-proper-alignment-of-resgen-_OFFSET-and-_SIZE-.patch b/debian/patches/0014-Ensure-proper-alignment-of-resgen-_OFFSET-and-_SIZE-.patch new file mode 100644 index 0000000..e968a7b --- /dev/null +++ b/debian/patches/0014-Ensure-proper-alignment-of-resgen-_OFFSET-and-_SIZE-.patch @@ -0,0 +1,20 @@ +From: =?utf-8?q?Timo_R=C3=B6hling?= +Date: Sun, 13 Feb 2022 00:58:20 +0100 +Subject: Ensure proper alignment of resgen _OFFSET and _SIZE variables + +--- + tools/resgen/src/main.cpp | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/tools/resgen/src/main.cpp b/tools/resgen/src/main.cpp +index e126b34..083e7d6 100644 +--- a/tools/resgen/src/main.cpp ++++ b/tools/resgen/src/main.cpp +@@ -312,6 +312,7 @@ int main(int argc, char* argv[]) { + << " extern int " << prname << "_SIZE;\n"; + + dataAsmStream ++ << " .balign 8\n" + << prname << "_OFFSET:\n" + << " .int " << offset << "\n" + << prname << "_SIZE:\n" diff --git a/debian/patches/0015-Ensure-proper-alignment-of-resgen-_OFFSET-and-_SIZE-.patch b/debian/patches/0015-Ensure-proper-alignment-of-resgen-_OFFSET-and-_SIZE-.patch deleted file mode 100644 index e968a7b..0000000 --- a/debian/patches/0015-Ensure-proper-alignment-of-resgen-_OFFSET-and-_SIZE-.patch +++ /dev/null @@ -1,20 +0,0 @@ -From: =?utf-8?q?Timo_R=C3=B6hling?= -Date: Sun, 13 Feb 2022 00:58:20 +0100 -Subject: Ensure proper alignment of resgen _OFFSET and _SIZE variables - ---- - tools/resgen/src/main.cpp | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/tools/resgen/src/main.cpp b/tools/resgen/src/main.cpp -index e126b34..083e7d6 100644 ---- a/tools/resgen/src/main.cpp -+++ b/tools/resgen/src/main.cpp -@@ -312,6 +312,7 @@ int main(int argc, char* argv[]) { - << " extern int " << prname << "_SIZE;\n"; - - dataAsmStream -+ << " .balign 8\n" - << prname << "_OFFSET:\n" - << " .int " << offset << "\n" - << prname << "_SIZE:\n" diff --git a/debian/patches/0015-Fix-FTBFS-with-GCC-12.patch b/debian/patches/0015-Fix-FTBFS-with-GCC-12.patch new file mode 100644 index 0000000..9ebeb43 --- /dev/null +++ b/debian/patches/0015-Fix-FTBFS-with-GCC-12.patch @@ -0,0 +1,20 @@ +From: =?utf-8?q?Timo_R=C3=B6hling?= +Date: Thu, 16 Jun 2022 18:46:44 +0200 +Subject: Fix FTBFS with GCC-12 + +--- + libs/utils/src/Profiler.cpp | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/libs/utils/src/Profiler.cpp b/libs/utils/src/Profiler.cpp +index 75caf87..61513b8 100644 +--- a/libs/utils/src/Profiler.cpp ++++ b/libs/utils/src/Profiler.cpp +@@ -27,6 +27,7 @@ + #endif + + #include ++#include + #include + + #if defined(__linux__) diff --git a/debian/patches/0016-Fix-FTBFS-with-GCC-12.patch b/debian/patches/0016-Fix-FTBFS-with-GCC-12.patch deleted file mode 100644 index 9ebeb43..0000000 --- a/debian/patches/0016-Fix-FTBFS-with-GCC-12.patch +++ /dev/null @@ -1,20 +0,0 @@ -From: =?utf-8?q?Timo_R=C3=B6hling?= -Date: Thu, 16 Jun 2022 18:46:44 +0200 -Subject: Fix FTBFS with GCC-12 - ---- - libs/utils/src/Profiler.cpp | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/libs/utils/src/Profiler.cpp b/libs/utils/src/Profiler.cpp -index 75caf87..61513b8 100644 ---- a/libs/utils/src/Profiler.cpp -+++ b/libs/utils/src/Profiler.cpp -@@ -27,6 +27,7 @@ - #endif - - #include -+#include - #include - - #if defined(__linux__) diff --git a/debian/patches/0016-Workaround-for-armel-clang-compiler-bug.patch b/debian/patches/0016-Workaround-for-armel-clang-compiler-bug.patch new file mode 100644 index 0000000..4601fb7 --- /dev/null +++ b/debian/patches/0016-Workaround-for-armel-clang-compiler-bug.patch @@ -0,0 +1,21 @@ +From: Adrian Bunk +Date: Mon, 18 Jul 2022 02:27:16 +0300 +Subject: Workaround for armel clang compiler bug + +--- + libs/utils/include/utils/compiler.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libs/utils/include/utils/compiler.h b/libs/utils/include/utils/compiler.h +index c0bdebf..ea63dbd 100644 +--- a/libs/utils/include/utils/compiler.h ++++ b/libs/utils/include/utils/compiler.h +@@ -176,7 +176,7 @@ + # define UTILS_HAS_RTTI 0 + #endif + +-#ifdef __ARM_ACLE ++#if defined(__ARM_ACLE) && (__ARM_ARCH >= 7) + # include + # define UTILS_WAIT_FOR_INTERRUPT() __wfi() + # define UTILS_WAIT_FOR_EVENT() __wfe() diff --git a/debian/patches/0017-Fix-TBuiltInResource-struct.patch b/debian/patches/0017-Fix-TBuiltInResource-struct.patch new file mode 100644 index 0000000..b8ec36b --- /dev/null +++ b/debian/patches/0017-Fix-TBuiltInResource-struct.patch @@ -0,0 +1,49 @@ +From: =?utf-8?q?Timo_R=C3=B6hling?= +Date: Sat, 12 Nov 2022 13:26:20 +0100 +Subject: Fix TBuiltInResource struct + +--- + filament/backend/test/builtinResource.h | 9 +++++++++ + libs/filamat/src/sca/builtinResource.h | 9 +++++++++ + 2 files changed, 18 insertions(+) + +diff --git a/filament/backend/test/builtinResource.h b/filament/backend/test/builtinResource.h +index 39ac194..78397fe 100644 +--- a/filament/backend/test/builtinResource.h ++++ b/filament/backend/test/builtinResource.h +@@ -107,6 +107,15 @@ const TBuiltInResource DefaultTBuiltInResource = { + /* .maxTaskWorkGroupSizeY_NV = */ 1, + /* .maxTaskWorkGroupSizeZ_NV = */ 1, + /* .maxMeshViewCountNV = */ 4, ++ /* .maxMeshOutputVerticesEXT = */ 256, ++ /* .maxMeshOutputPrimitivesEXT = */ 256, ++ /* .maxMeshWorkGroupSizeX_EXT = */ 128, ++ /* .maxMeshWorkGroupSizeY_EXT = */ 128, ++ /* .maxMeshWorkGroupSizeZ_EXT = */ 128, ++ /* .maxTaskWorkGroupSizeX_EXT = */ 128, ++ /* .maxTaskWorkGroupSizeY_EXT = */ 128, ++ /* .maxTaskWorkGroupSizeZ_EXT = */ 128, ++ /* .maxMeshViewCountEXT = */ 4, + /* .maxDualSourceDrawBuffersEXT = */ 1, + + /* .limits = */ { +diff --git a/libs/filamat/src/sca/builtinResource.h b/libs/filamat/src/sca/builtinResource.h +index 4419eb6..c47c8e0 100644 +--- a/libs/filamat/src/sca/builtinResource.h ++++ b/libs/filamat/src/sca/builtinResource.h +@@ -107,6 +107,15 @@ const TBuiltInResource DefaultTBuiltInResource = { + /* .maxTaskWorkGroupSizeY_NV = */ 1, + /* .maxTaskWorkGroupSizeZ_NV = */ 1, + /* .maxMeshViewCountNV = */ 4, ++ /* .maxMeshOutputVerticesEXT = */ 256, ++ /* .maxMeshOutputPrimitivesEXT = */ 256, ++ /* .maxMeshWorkGroupSizeX_EXT = */ 128, ++ /* .maxMeshWorkGroupSizeY_EXT = */ 128, ++ /* .maxMeshWorkGroupSizeZ_EXT = */ 128, ++ /* .maxTaskWorkGroupSizeX_EXT = */ 128, ++ /* .maxTaskWorkGroupSizeY_EXT = */ 128, ++ /* .maxTaskWorkGroupSizeZ_EXT = */ 128, ++ /* .maxMeshViewCountEXT = */ 4, + /* .maxDualSourceDrawBuffersEXT = */ 1, + + /* .limits = */ { diff --git a/debian/patches/0017-Workaround-for-armel-clang-compiler-bug.patch b/debian/patches/0017-Workaround-for-armel-clang-compiler-bug.patch deleted file mode 100644 index 4601fb7..0000000 --- a/debian/patches/0017-Workaround-for-armel-clang-compiler-bug.patch +++ /dev/null @@ -1,21 +0,0 @@ -From: Adrian Bunk -Date: Mon, 18 Jul 2022 02:27:16 +0300 -Subject: Workaround for armel clang compiler bug - ---- - libs/utils/include/utils/compiler.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/libs/utils/include/utils/compiler.h b/libs/utils/include/utils/compiler.h -index c0bdebf..ea63dbd 100644 ---- a/libs/utils/include/utils/compiler.h -+++ b/libs/utils/include/utils/compiler.h -@@ -176,7 +176,7 @@ - # define UTILS_HAS_RTTI 0 - #endif - --#ifdef __ARM_ACLE -+#if defined(__ARM_ACLE) && (__ARM_ARCH >= 7) - # include - # define UTILS_WAIT_FOR_INTERRUPT() __wfi() - # define UTILS_WAIT_FOR_EVENT() __wfe() diff --git a/debian/patches/0018-Fix-TBuiltInResource-struct.patch b/debian/patches/0018-Fix-TBuiltInResource-struct.patch deleted file mode 100644 index b8ec36b..0000000 --- a/debian/patches/0018-Fix-TBuiltInResource-struct.patch +++ /dev/null @@ -1,49 +0,0 @@ -From: =?utf-8?q?Timo_R=C3=B6hling?= -Date: Sat, 12 Nov 2022 13:26:20 +0100 -Subject: Fix TBuiltInResource struct - ---- - filament/backend/test/builtinResource.h | 9 +++++++++ - libs/filamat/src/sca/builtinResource.h | 9 +++++++++ - 2 files changed, 18 insertions(+) - -diff --git a/filament/backend/test/builtinResource.h b/filament/backend/test/builtinResource.h -index 39ac194..78397fe 100644 ---- a/filament/backend/test/builtinResource.h -+++ b/filament/backend/test/builtinResource.h -@@ -107,6 +107,15 @@ const TBuiltInResource DefaultTBuiltInResource = { - /* .maxTaskWorkGroupSizeY_NV = */ 1, - /* .maxTaskWorkGroupSizeZ_NV = */ 1, - /* .maxMeshViewCountNV = */ 4, -+ /* .maxMeshOutputVerticesEXT = */ 256, -+ /* .maxMeshOutputPrimitivesEXT = */ 256, -+ /* .maxMeshWorkGroupSizeX_EXT = */ 128, -+ /* .maxMeshWorkGroupSizeY_EXT = */ 128, -+ /* .maxMeshWorkGroupSizeZ_EXT = */ 128, -+ /* .maxTaskWorkGroupSizeX_EXT = */ 128, -+ /* .maxTaskWorkGroupSizeY_EXT = */ 128, -+ /* .maxTaskWorkGroupSizeZ_EXT = */ 128, -+ /* .maxMeshViewCountEXT = */ 4, - /* .maxDualSourceDrawBuffersEXT = */ 1, - - /* .limits = */ { -diff --git a/libs/filamat/src/sca/builtinResource.h b/libs/filamat/src/sca/builtinResource.h -index 4419eb6..c47c8e0 100644 ---- a/libs/filamat/src/sca/builtinResource.h -+++ b/libs/filamat/src/sca/builtinResource.h -@@ -107,6 +107,15 @@ const TBuiltInResource DefaultTBuiltInResource = { - /* .maxTaskWorkGroupSizeY_NV = */ 1, - /* .maxTaskWorkGroupSizeZ_NV = */ 1, - /* .maxMeshViewCountNV = */ 4, -+ /* .maxMeshOutputVerticesEXT = */ 256, -+ /* .maxMeshOutputPrimitivesEXT = */ 256, -+ /* .maxMeshWorkGroupSizeX_EXT = */ 128, -+ /* .maxMeshWorkGroupSizeY_EXT = */ 128, -+ /* .maxMeshWorkGroupSizeZ_EXT = */ 128, -+ /* .maxTaskWorkGroupSizeX_EXT = */ 128, -+ /* .maxTaskWorkGroupSizeY_EXT = */ 128, -+ /* .maxTaskWorkGroupSizeZ_EXT = */ 128, -+ /* .maxMeshViewCountEXT = */ 4, - /* .maxDualSourceDrawBuffersEXT = */ 1, - - /* .limits = */ { diff --git a/debian/patches/0018-Fix-compatibility-with-spirv-cross-SDK-1.3.236.patch b/debian/patches/0018-Fix-compatibility-with-spirv-cross-SDK-1.3.236.patch new file mode 100644 index 0000000..2419ca0 --- /dev/null +++ b/debian/patches/0018-Fix-compatibility-with-spirv-cross-SDK-1.3.236.patch @@ -0,0 +1,24 @@ +From: =?utf-8?q?Timo_R=C3=B6hling?= +Date: Sat, 28 Jan 2023 00:24:04 +0100 +Subject: Fix compatibility with spirv-cross SDK 1.3.236 + +--- + libs/filamat/src/GLSLPostProcessor.cpp | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/libs/filamat/src/GLSLPostProcessor.cpp b/libs/filamat/src/GLSLPostProcessor.cpp +index 678f069..c774bd9 100644 +--- a/libs/filamat/src/GLSLPostProcessor.cpp ++++ b/libs/filamat/src/GLSLPostProcessor.cpp +@@ -346,7 +346,11 @@ void GLSLPostProcessor::fullOptimization(const TShader& tShader, + + if (tShader.getStage() == EShLangFragment && glslOptions.es) { + for (auto i : config.glsl.subpassInputToColorLocation) { ++#if SPV_VERSION >= 0x10600 ++ glslCompiler.remap_ext_framebuffer_fetch(i.first, i.second, true); ++#else + glslCompiler.remap_ext_framebuffer_fetch(i.first, i.second); ++#endif + } + } + diff --git a/debian/patches/0019-Fix-compatibility-with-spirv-cross-SDK-1.3.236.patch b/debian/patches/0019-Fix-compatibility-with-spirv-cross-SDK-1.3.236.patch deleted file mode 100644 index 2419ca0..0000000 --- a/debian/patches/0019-Fix-compatibility-with-spirv-cross-SDK-1.3.236.patch +++ /dev/null @@ -1,24 +0,0 @@ -From: =?utf-8?q?Timo_R=C3=B6hling?= -Date: Sat, 28 Jan 2023 00:24:04 +0100 -Subject: Fix compatibility with spirv-cross SDK 1.3.236 - ---- - libs/filamat/src/GLSLPostProcessor.cpp | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/libs/filamat/src/GLSLPostProcessor.cpp b/libs/filamat/src/GLSLPostProcessor.cpp -index 678f069..c774bd9 100644 ---- a/libs/filamat/src/GLSLPostProcessor.cpp -+++ b/libs/filamat/src/GLSLPostProcessor.cpp -@@ -346,7 +346,11 @@ void GLSLPostProcessor::fullOptimization(const TShader& tShader, - - if (tShader.getStage() == EShLangFragment && glslOptions.es) { - for (auto i : config.glsl.subpassInputToColorLocation) { -+#if SPV_VERSION >= 0x10600 -+ glslCompiler.remap_ext_framebuffer_fetch(i.first, i.second, true); -+#else - glslCompiler.remap_ext_framebuffer_fetch(i.first, i.second); -+#endif - } - } - diff --git a/debian/patches/series b/debian/patches/series index 83f6b96..e9f0d4d 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -9,11 +9,10 @@ 0009-Fix-library-export-for-Debian.patch 0010-Rename-resgen-executable-to-avoid-conflict-with-mono.patch 0011-Replace-BlueGL-with-epoxy.patch -0012-Use-system-spirv-cross.patch -0013-Define-M_PIf-only-if-it-is-not-already-defined-in-ma.patch -0014-Avoid-mips-as-identifier-because-it-fails-on-mips-ar.patch -0015-Ensure-proper-alignment-of-resgen-_OFFSET-and-_SIZE-.patch -0016-Fix-FTBFS-with-GCC-12.patch -0017-Workaround-for-armel-clang-compiler-bug.patch -0018-Fix-TBuiltInResource-struct.patch -0019-Fix-compatibility-with-spirv-cross-SDK-1.3.236.patch +0012-Define-M_PIf-only-if-it-is-not-already-defined-in-ma.patch +0013-Avoid-mips-as-identifier-because-it-fails-on-mips-ar.patch +0014-Ensure-proper-alignment-of-resgen-_OFFSET-and-_SIZE-.patch +0015-Fix-FTBFS-with-GCC-12.patch +0016-Workaround-for-armel-clang-compiler-bug.patch +0017-Fix-TBuiltInResource-struct.patch +0018-Fix-compatibility-with-spirv-cross-SDK-1.3.236.patch